import http from '@http/http'
function severice () {
  let myseverice = {}
  // 通过站点名称模糊匹配辅导员信息
  myseverice._selectCityByName = data => {
    return http.POST(`./api/common/selectCityByName`, data)
  }
  // 获取所有的民族
  myseverice._getNations = () => {
    return http.GET(`./api/common/getNations`)
  }
  // 获取所有的政治面貌
  myseverice._getPolitic = () => {
    return http.GET(`./api/common/getPoliticStatus`)
  }
  // 获取性别列表
  myseverice._getGenderList = () => {
    return new Promise((resolve, reject) => {
      resolve([
        {
          id: 1,
          name: '男'
        },
        {
          id: 2,
          name: '女'
        },
        {
          id: -1,
          name: '未知'
        }
      ])
    })
  }
  // 根据sn查看辅导员、学院、学校用户个人信息
  myseverice._findPersonalInfoBySn = () => {
    return http.GET(`./api/managerInfo/findBySn`)
  }
  // 根据sn获取学生信息
  myseverice._managerGetStudentInfoBySn = sn => {
    return http.GET(`./api/managerInfo/getStudentBaseInfo/${sn}`)
  }
  // 根据sn获取历史学生信息
  myseverice._getStudentBaseInfoHistory = sn => {
    return http.GET(`./api/managerInfo/getStudentBaseInfoHistory/${sn}`)
  }

  // 获取学生搜索
  myseverice._getStudentList = data => {
    return http.POST(`./api/schoolOrCollegeOrInstructor/findByQuery`, data)
  }

  // 获取学生信息列表
  myseverice._getStudentInfoList = data => {
    return http.POST(`./api/managerInfo/getStudentInfoListNew`, data)
  }

  // 获取学生信息列表-历史记录
  myseverice._getStudentInfoListHistory = data => {
    return http.POST(`./api/managerInfo/getStudentInfoListHistory`, data)
  }
  // 修改辅导员、学院、学校用户个人信息
  myseverice._updateManagerInfo = data => {
    return http.POST(`./api/managerInfo/update`, data)
  }
  // 导出
  myseverice._managerExport = data => {
    return http.POST(`./api/managerInfo/export`, data, '接口异常', 300000)
  }
  // 获取所有的校区
  myseverice._getCampus = () => {
    return http.GET(`./api/common/getCampus`)
  }
  // 获取管理的所有学院
  myseverice._getAllCollege = () => {
    return http.GET(`./api/common/getManageColleges`)
  }
  // 根据学院获取专业
  myseverice._getMajordByCollege = id => {
    return http.GET(`./api/common/getMajorsByCollege/${id}`)
  }
  // 根据专业ID查找专业下的年级
  myseverice._findGradeByMajor = (id) => {
    return http.GET(`./api/common/findGradeByMajor/${id}`)
  }
  // 获取所有年级
  myseverice._getAllGrades = () => {
    return http.GET(`./api/common/getAllGrade`)
  }
  // 根据专业获取所有班级
  myseverice._getClazzByMajor = id => {
    return http.GET(`./api/common/getClassesByMajor/${id}`)
  }
  // 根据专业获取所有班级
  myseverice._findAllCollege = () => {
    return http.GET(`./api/common/getColleges`)
  }
  /* 根据专业和年级来获取班级信息 */
  myseverice._getClassesByMajorAndGrade = (majorId, grade) => {
    return http.GET(`./api/common/getClassesByMajorAndGrade/${majorId}/${grade}`)
  }
  // 男女映射
  myseverice._genderType = id => {
    switch (id) {
      case 1:
        return {
          id: 1,
          name: '男'
        }
      case 2:
        return {
          id: 2,
          name: '女'
        }
      default:
        return {
          id: -1,
          name: '未知'
        }
    }
  }
  // GET /api/common/getProvinces 获取所有的省份(新表)
  myseverice._getProvinces = () => {
    return http.GET(`./api/common/getProvinces`)
  }
  // GET /api/common/getProvincesAll 获取所有的行政区(新表)
  myseverice._getProvincesAll = () => {
    return http.GET(`./api/common/getProvincesAll`)
  }
  // GET /api/studentManage/findAllCustomSelection 获取全部动态选择展示字段
  myseverice._findAllCustomSelection = () => {
    return http.GET(`./api/common/findAllCustomSelection`)
  }
  // 根据sn修改密码
  myseverice._updatePassWord = data => {
    return http.POST(`./api/managerInfo/updatePassWord`, data)
  }
  // 获取学生综合信息
  myseverice._getStudentAllInfo = sn => {
    return http.GET(`./api/managerInfo/getStudentAllInfo/${sn}`)
  }
  // 获取学生历史综合信息
  myseverice._getStudentAllInfoHistory = sn => {
    return http.GET(`./api/managerInfo/getStudentAllInfoHistory/${sn}`)
  }
  // 学生综合信息word下载
  myseverice._studentAllInfoDownWord = sn => {
    return http.GET(`./api/managerInfo/studentAllInfoDownWord/${sn}`)
  }
  // 学校查询学院提交修改个人信息情况
  myseverice._queryCollegeCensus = data => {
    return http.POST(`./api/managerInfo/queryCollegeCensus`, data)
  }
  // 学校/学院查询班级提交修改个人信息列表
  myseverice._queryClassCensusList = data => {
    return http.POST(`./api/managerInfo/queryClassCensusList`, data)
  }
  // 学校/学院/辅导员查询班级提交修改个人信息情况
  myseverice._queryClassCensusDetail = data => {
    return http.POST(`./api/managerInfo/queryClassCensusDetail`, data)
  }
  // 下载学校查询学院提交修改个人信息情况
  myseverice._downCollegeCensus = data => {
    return http.POST(`./api/managerInfo/downCollegeCensus`, data)
  }
  // 下载学校/学院查询班级提交修改个人信息列表
  myseverice._downClassCensusList = data => {
    return http.POST(`./api/managerInfo/downClassCensusList`, data)
  }
  // 下载学校/学院/辅导员查询班级提交修改个人信息情况
  myseverice._downClassCensusDetail = data => {
    return http.POST(`./api/managerInfo/downClassCensusDetail`, data)
  }
  // 下载学院提交修改信息情况明细
  myseverice._downCollegeCensusDetail = data => {
    return http.POST(
      `./api/managerInfo/downCollegeCensusDetail`,
      data,
      '接口异常',
      300000
    )
  }

  // 获取民族
  myseverice._findAllNation = () => {
    return http.GET(`./api/common/getNations`)
  }
  // 获取省份
  myseverice._findAllProvince = () => {
    return http.GET(`./api/common/getProvinces`)
  }
  // 获取政治面貌
  myseverice._getAllPoliticsStatus = () => {
    return http.GET(`./api/common/getPoliticStatus`)
  }
  // 获取校区
  myseverice._getStudentCampus = () => {
    return http.GET(`./api/common/getCampus`)
  }
  // 获取学生状态
  myseverice._getStudentStatus = () => {
    return http.GET(`./api/common/getAllStudentStatus`)
  }
  // 获取身份证件类型
  myseverice._getcardTypeList = () => {
    return http.GET(`./api/common/getAllIdType`)
  }
  // 根据sn修改密码
  myseverice._updateStudentInfo = data => {
    return http.POST(`./api/infoManagement/updateStudentInfo`, data)
  }
  // 匹配状态
  myseverice._StudentStatusFilter = (id) => {
    switch (id) {
      case 0:
        return {
          id: 0,
          name: '在校'
        }
      case 1:
        return {
          id: 1,
          name: '休学'
        }
      case 2:
        return {
          id: 2,
          name: '退学'
        }
      case 3:
        return {
          id: 3,
          name: '服兵役'
        }
      case 5:
        return {
          id: 5,
          name: '实习'
        }
      default:
        return {
          id: null,
          name: null
        }
    }
  }
  // 户口类型映射
  myseverice._getNodeType = (id) => {
    switch (id) {
      case 1:
        return {
          id: 1,
          name: '农业'
        }
      case 0:
        return {
          id: 0,
          name: '非农业'
        }
      default:
        return {
          id: null,
          name: null
        }
    }
  }
  return myseverice
}
export default severice
